package controller;

import entity.Commtype;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.CommtypeService;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/commtype")
public class CommtypeCon {
    @Resource(name="commtypeService")
    private CommtypeService commtypeService;

    @RequestMapping("/list")
    @ResponseBody
    public List<Commtype> list(){
        return commtypeService.list();
    }

    @RequestMapping("/add")
    @ResponseBody
    public List<Commtype> add(String name){
        int i = commtypeService.add(name);
        return list();
    }


}
